<template>
  <div class="box">
    <van-nav-bar title="账单" left-text="返回" left-arrow @click-left="onClickLeft" />
    <div v-for="(item, index) in record" :key="index" class="record-item">
      <div class="left">
        <p>{{ item.name }}</p>
        <p>{{ item.time }}</p>
      </div>
      <div class="right">
        <p>{{ item.price }}</p>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const record = ref(localStorage.getItem('record') ? JSON.parse(localStorage.getItem('record')) : [])
const onClickLeft = () => history.back()
</script>
<style lang="scss">
.box {
  width: 100vw;
  height: 100vh;
  background-color: #f2f2f2;
}
.record-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background-color: #fff;
  border-radius: 5px;
  border-bottom: 1px solid #f5f5f5;
}
.left {
  text-align: left;
  flex: .9;
  p{
     margin-bottom: .5rem;
  }
}
</style>
